package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.financing.wap.common.BizEnums.CommonEnums;
import com.financing.wap.dao.IFpClientActivityUserDao;
import com.financing.wap.dto.FpClientActivityUserDTO;
import com.financing.wap.service.IFpClientActivityUserService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * fp_client_activity_user  
 * 客户活动报名用户 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("fpClientActivityUserService")
public class FpClientActivityUserServiceImpl implements IFpClientActivityUserService{

	@Autowired
	private IFpClientActivityUserDao fpClientActivityUserDao;

	@Override
	public int insert(FpClientActivityUserDTO fpClientActivityUser) throws SQLException {
		DTOdateSetUtil.setCreateInfo(fpClientActivityUser);
		DTOdateSetUtil.setUpdateInfo(fpClientActivityUser);
		fpClientActivityUser.setDeleteTag(CommonEnums.VALID_FLAG_1);
		return fpClientActivityUserDao.insert(fpClientActivityUser);
	}

	@Override
	public void update(FpClientActivityUserDTO fpClientActivityUser) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(fpClientActivityUser);
		fpClientActivityUserDao.update(fpClientActivityUser);
	}

	@Override
	public void updateForce(FpClientActivityUserDTO fpClientActivityUser) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(fpClientActivityUser);
		fpClientActivityUserDao.updateForce(fpClientActivityUser);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		fpClientActivityUserDao.delete(id);
	}
	
	@Override
	public List<FpClientActivityUserDTO> queryList(FpClientActivityUserDTO fpClientActivityUser) throws SQLException {
		return fpClientActivityUserDao.queryList(fpClientActivityUser);
	}

	@Override
	public int queryListCount(FpClientActivityUserDTO fpClientActivityUser) throws SQLException {
		return fpClientActivityUserDao.queryListCount(fpClientActivityUser);
	}

	@Override
	public FpClientActivityUserDTO loadById(Integer id) throws SQLException {
		return fpClientActivityUserDao.loadById(id);
	}
 	@Override
	public FpClientActivityUserDTO queryListGetFirst(FpClientActivityUserDTO fpClientActivityUser)
			throws SQLException {
		 List<FpClientActivityUserDTO> queryList = queryList(fpClientActivityUser);
		 if(queryList==null||queryList.size()==0){
			 return new FpClientActivityUserDTO();
		 }
		 return queryList.get(0);
	}
}
